<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{if isset($SEO['title']) && !empty($SEO['title'])}{$SEO['title']}{/if}{$SEO['site_title']}</title>
<meta name="Keywords" content="{$SEO['keyword']}" />
<meta name="Description" content="{$SEO['description']}" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
<script type="text/javascript" src="{THEME_PATH}js/jquery-1.11.3.min.js"></script>
<link rel="stylesheet" type="text/css" href="{THEME_PATH}style/appStyle.css" />
</head>
<body>
<div class="app_head"> <a class="app_headLeft" href="/index.php?m=union&c=union&a=index"><img src="{THEME_PATH}images/app_head_fangdajing.svg" /></a>
  <h1 class="app_hdTitle">金商道商城</h1>
  <div class="app_headRight" href="/index.php?m=union&c=union&a=index"> <i>&#xe600</i>
    <ul class="app_userNavList">
      <li> <a href="{U('User/Pay/init')}">充值提现</a> </li>
      <li> <a href="{U('User/Order/orderdown')}">我的消费</a> </li>
      <li> <a href="{U('User/Coupons/score')}">我的积分</a> </li>
      <li> <a href="{U('User/Coupons/money')}">资金流水</a> </li>
    </ul>
  </div>
</div>
<div id="bannerParent" class="app_banner">
  <ul>
    {hd:focus action="lists" num="5" order="sort ASC, id DESC" }
    {loop $data $r}
    {if $r[pic]}
    <li> <a href="{$r[url]}" style="background-image:url({$r[pic]})"></a> </li>
    {/if}
    {/loop}
    {/hd}
  </ul>
  <div class="app_change">
    <ul>
    </ul>
  </div>
</div>
<div class="app_gonggao"> <img src="{THEME_PATH}images/app_gonggao_img.png" /> <a class="app_moreA" href="/index.php?m=article&c=index&a=lists&id=7">更多>></a>
  <ul>
    {hd:article action="lists" num="5" order="id DESC"}
    {php $i = 0;}
    {loop $data $r}
    {php $i++;}
    <li> <a href="{U('Article/Index/detail', array('id'=> $r[id]))}">
      <p class="app_userId">{msubstr($r[title],27)}</p>
      </a> </li>
    {/loop}
    {/hd}
  </ul>
</div>
<ul class="app_helpList">
  <li class="li1">
  	<a href="/index.php?m=help&c=help&a=detail&id=18">
        <h1>赠送模式</h1>
        <p>新型商业模式</p>
        <img src="{THEME_PATH}images/app_helpList1.png" />
    </a> </li>
  <li class="li2">
  	<a href="/index.php?m=help&c=help&a=detail&id=25">
        <h1>新手指引</h1>
        <p>小白变大神</p>
        <img src="{THEME_PATH}images/app_helpList2.png" />
    </a> </li>
  <li class="li3">
  	<a href="/index.php?m=league&c=league">
        <h1>加盟合作</h1>
        <p>共创双赢平台</p>
        <img src="{THEME_PATH}images/app_helpList3.png" />
    </a> </li>
</ul>
<div class="app_ruzhu">
  <h1> <span>推荐<font>·</font>联盟商家</span> <a href="{U('Union/Union/index')}">更多>></a> </h1>
  <div>
    <ul class="app_rzList">
      {hd:union action="lists" num="3" tuijian="1" order=" id desc"}
      {loop $data $r}
      <li> <a href="{U('union/union/detail', array('id'=> $r[id]))}">
        <div class="app_fenlei">{$r[type_name]}</div>
        {if empty($r[company_logo])} <img src="{THEME_PATH}images/nopic.jpg"  /> {else} <img src="{$r[company_logo]}"/> {/if}
        <p>{$r[company_name]}</p>
        </a> </li>
      {/loop}
      {/hd}
    </ul>
  </div>
</div>
<div class="app_sellRuZhu">
  <p class="app_xianbg"></p>
  <h1>金商道联盟商家</h1>
  <ul class="app_srzList">
    {hd:union action="lists" num="6" order=" id desc"}
    {loop $data $r}
    <li> <a href="{U('union/union/detail', array('id'=> $r[id]))}">
      <div class="app_fenlei">{$r[type_name]}</div>
      {if empty($r[company_logo])} <img src="{THEME_PATH}images/nopic.jpg"  /> {else} <img src="{$r[company_logo]}"/> {/if}
      <h1>{$r[company_name]}</h1>
      <p>{$r[prov_name]}·{$r[city_name]}</p>
      </a> </li>
    {/loop}
    {/hd}
  </ul>
</div>

<script type="text/javascript">
$(function()//banner图片切换
{
	var setIndex = 0;
	var mediaWid = $(window).width();
	$(".app_banner > ul > li").css("width",mediaWid + "px");
	for(var i=0;i<$(".app_banner > ul > li").length;i++)
	{
		var oLi = document.createElement("li");
		$(".app_change > ul").get(0).appendChild(oLi);
	}
	$(".app_banner > ul").css("width" , mediaWid * $(".app_banner > ul > li").length);
	$(".app_change > ul > li").click(function()
	{
		var clickIndex = $(this).index();
		setIndex = clickIndex;
		$(".app_banner > ul").animate({marginLeft : -(mediaWid * clickIndex)});
		$(".app_change > ul > li").css({opacity:0.5 , backgroundColor:"#fff"});
		$(this).css({opacity:1 , backgroundColor:"#fff"});
	});
	function setBannerChange()
	{
		if(setIndex <$(".app_banner > ul > li").length)
		{
			$(".app_banner > ul").animate({marginLeft : -(mediaWid * setIndex)});
			$(".app_change > ul > li").css({opacity:0.5 , backgroundColor:"#fff"});
			$(".app_change > ul > li").eq(setIndex).css({opacity:1 , backgroundColor:"#fff"});
			setIndex++;
		}
		else{
			setIndex = 0;
			$(".app_banner > ul").animate({marginLeft : -(mediaWid * setIndex)});
			$(".app_change > ul > li").css({opacity:0.5 , backgroundColor:"#fff"});
			$(".app_change > ul > li").eq(setIndex).css({opacity:1 , backgroundColor:"#fff"});
		}
	}
	var setBanner = setInterval(setBannerChange,3000); 
	var _x;//鼠标离控件左上角的相对位置
	var _move=false;//移动标记 
	var bl = false;
	var bannerList = document.getElementById("bannerParent").getElementsByTagName("li");
	function tStart(event)
	{
		event.preventDefault();
		t_bannerIndex = $(this).index();
		t_bannerUlMargin = parseInt($(".app_banner > ul").css("margin-left"));
		clearInterval(setBanner);
		if(event.targetTouches.length == 1)
		{
			startX =  event.targetTouches[0].pageX;
		}
	}
	function tMove(event)
	{
		event.preventDefault();
		if(event.targetTouches.length == 1)
		{
			bl = true;
			var tx = event.targetTouches[0].pageX - startX;
			$(".app_banner > ul").css("margin-left" , t_bannerUlMargin + tx);
		}
	}
	for(var i=0;i<bannerList.length;i++)
	{
		bannerList[i].addEventListener("touchstart",tStart,false);
		bannerList[i].addEventListener("touchmove",tMove,false);
		bannerList[i].addEventListener("touchend",function()
		{
			if(bl)
			{
				var moveX = event.changedTouches[0].pageX;
				var cha = moveX - startX;
				if(cha < -20)
				{
					if(t_bannerIndex < $(".app_banner > ul > li").length - 1)
					{
						$(".app_banner > ul").animate({marginLeft: -(mediaWid * (t_bannerIndex + 1))});
						$(".app_change > ul > li").css({opacity:0.5 , backgroundColor:"#fff"});
						$(".app_change > ul > li").eq(t_bannerIndex + 1).css({opacity:1 , backgroundColor:"#fff"});
					}
					else{
						$(".app_banner > ul").animate({marginLeft: t_bannerUlMargin});
					}
				}
				else if(cha > 20)
				{
					if(t_bannerIndex > 0)
					{
						$(".app_banner > ul").animate({marginLeft: -(mediaWid * (t_bannerIndex - 1))});
						$(".app_change > ul > li").css({opacity:0.5 , backgroundColor:"#fff"});
						$(".app_change > ul > li").eq(t_bannerIndex - 1).css({opacity:1 , backgroundColor:"#fff"});
					}
					else{
						$(".app_banner > ul").animate({marginLeft: t_bannerUlMargin});
					}
				}
				else{
					for(var i=0;i<bannerList.length;i++)
					{
						bannerList[i].removeEventListener("touchstart",tStart);
					}
				}
			}
			setBanner = setInterval(setBannerChange,3000);
		},false);
	}
});

function newChange()//控制公告滚动
{
	$(".app_gonggao > ul").animate({marginTop:"-24px"},function()
	{
		var oli=$(".app_gonggao > ul > li").get(0).cloneNode(true);
		$(".app_gonggao > ul").get(0).appendChild(oli);
		$(".app_gonggao > ul").get(0).removeChild($(".app_gonggao > ul > li").get(0));
		$(".app_gonggao > ul").css("margin-top","0");
	});
}
$(function()
{
	var setNewId = setInterval("newChange()",2000);
	$(".app_gonggao > ul").hover(function()
	{
		clearInterval(setNewId);
	},function()
	{
		setNewId = setInterval("newChange()",2000);
	});
});
$(function()//点击用户导航面板展现
{
	$(".app_headRight").click(function()
	{
		if($(this).css("overflow")!="hidden"){
			$(this).css("overflow","hidden").css("background-color","transparent").css("color","#fff");
		}else{
			$(this).css("overflow","visible").css("background-color","#fff").css("color","#d41c4f");
		}
	});
	$(".app_userNavList > li").click(function(e)
	{
		e.stopPropagation();
		$(this).css("background-color","#d41c4f");
		$(this).find("a").css("color","#fff");
	});
});
</script> 
<!--{subtemplate common/footer}-->